package com.wc.alorithm_blue_bridge._前缀和与差分.Q3217;

import java.util.Scanner;

/**
 * @Author congege
 * @Description
 * 简单的异或难题
 * https://www.lanqiao.cn/problems/3217/learning/?page=1&first_category_id=1
 * @Date Created in 2023/11/25-17:28
 */
public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int m = scan.nextInt();
        int[] array = new int[n + 1];
        for (int i = 1; i <= n; i++) {
            int num = scan.nextInt();
            array[i] = num ^ array[i - 1];
        }
        while (m-- > 0) {
            int l = scan.nextInt();
            int r = scan.nextInt();
            System.out.println(array[l - 1] ^ array[r]);
        }
        scan.close();
    }
}
